package com.qding.park.adapter.report.conf;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.qding.park.common.utils.qiniu.ImgServiceInPrivate;

import redis.clients.jedis.JedisPoolConfig;

@Configuration
@Scope("singleton")
public class SystemBean {
	
	private static final Logger logger = LoggerFactory.getLogger(SystemBean.class);
	
	@Autowired
	private SystemConfig systemConfig;
	
	
	@Bean(name = "imgServiceInPrivate")
	public ImgServiceInPrivate getImgServiceInPrivate() throws FileNotFoundException, IOException {
		logger.debug("systemConfig" + systemConfig);
		logger.info("systemConfig config ==> accessKey:{},bucketName:{},domain:{}, secretKey:{},tokenExpire:{} ",systemConfig.getAccessKey(),systemConfig.getBucketName(),systemConfig.getDomain(),systemConfig.getSecretKey(),systemConfig.getToken_expire());
		
		String accessKey=systemConfig.getAccessKey();
		
		String secretKey=systemConfig.getSecretKey();
		
		String bucketName=systemConfig.getBucketName();
		
		String domain=systemConfig.getDomain();
		
		Long tokenExpire=systemConfig.getToken_expire();
		
		ImgServiceInPrivate img=new ImgServiceInPrivate(accessKey,secretKey,bucketName,domain,tokenExpire);
		return img;
	}

}
